// 导入变量
@import './variables.scss';

// 全局样式重置
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  height: 100%;
  background-color: $bg-dark;
  color: $text-white;
  overflow: hidden;
  position: fixed;
  width: 100%;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-overflow-scrolling: touch;
  
  // 禁用下拉刷新
  overscroll-behavior: none;
  // 禁用双击缩放
  touch-action: manipulation;
}

#app {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

// 安全区域适配
@supports (padding: max(0px)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

// 滚动条样式 - 抖音风格
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(45deg, $primary-color, $primary-hover);
  border-radius: 2px;
  
  &:hover {
    background: linear-gradient(45deg, $primary-hover, $primary-active);
  }
}

// 通用工具类
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

.cursor-pointer {
  cursor: pointer;
}

.transition {
  transition: $transition-normal;
}

.no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

// 抖音风格按钮
.btn-primary {
  background: linear-gradient(135deg, $primary-color 0%, $primary-hover 100%);
  color: $text-white;
  border: none;
  border-radius: $border-radius;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: $transition-fast;
  position: relative;
  overflow: hidden;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
  }
  
  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(254, 44, 85, 0.3);
    
    &::before {
      left: 100%;
    }
  }
  
  &:active {
    transform: translateY(0);
  }
  
  &.large {
    padding: 16px 32px;
    font-size: 18px;
  }
  
  &.small {
    padding: 8px 16px;
    font-size: 14px;
  }
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: $text-white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: $border-radius;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: $transition-fast;
  backdrop-filter: blur(10px);
  
  &:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
  }
}

// 抖音风格输入框
.input-field {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: $border-radius;
  background: rgba(255, 255, 255, 0.05);
  color: $text-white;
  font-size: 16px;
  outline: none;
  transition: $transition-fast;
  backdrop-filter: blur(10px);
  
  &::placeholder {
    color: rgba(255, 255, 255, 0.5);
  }
  
  &:focus {
    border-color: $primary-color;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(254, 44, 85, 0.1);
  }
}

// 抖音风格卡片
.card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: $border-radius-lg;
  padding: 24px;
  transition: $transition-normal;
  
  &:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  }
}

// 加载动画 - 抖音风格
.loading {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: $primary-color;
  animation: spin 0.8s ease-in-out infinite;
}

.loading-pulse {
  display: inline-block;
  width: 40px;
  height: 40px;
  background: $primary-color;
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes spin {
  to { 
    transform: rotate(360deg); 
  }
}

@keyframes pulse {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

// 页面切换动画
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

// 抖音风格的上下滑动动画
.slide-up-enter-active,
.slide-up-leave-active {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.slide-up-enter-from {
  transform: translateY(100%);
  opacity: 0;
}

.slide-up-leave-to {
  transform: translateY(-100%);
  opacity: 0;
}

.slide-down-enter-active,
.slide-down-leave-active {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.slide-down-enter-from {
  transform: translateY(-100%);
  opacity: 0;
}

.slide-down-leave-to {
  transform: translateY(100%);
  opacity: 0;
}

// 点赞动画
@keyframes likeHeart {
  0% {
    transform: scale(1);
  }
  15% {
    transform: scale(1.3);
  }
  30% {
    transform: scale(0.9);
  }
  45% {
    transform: scale(1.1);
  }
  60% {
    transform: scale(1);
  }
}

.like-animation {
  animation: likeHeart 0.6s ease-in-out;
}

// 浮动动画
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.float-animation {
  animation: float 3s ease-in-out infinite;
}

// 弹性动画
@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translate3d(0, 0, 0);
  }
  40%, 43% {
    transform: translate3d(0, -15px, 0);
  }
  70% {
    transform: translate3d(0, -7px, 0);
  }
  90% {
    transform: translate3d(0, -2px, 0);
  }
}

.bounce-animation {
  animation: bounce 1s ease-in-out;
}

// 抖音特效粒子动画
@keyframes sparkle {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: scale(1) rotate(180deg);
    opacity: 0.8;
  }
  100% {
    transform: scale(0) rotate(360deg);
    opacity: 0;
  }
}

.sparkle-animation {
  animation: sparkle 1s ease-in-out;
}

// 移动端特殊样式
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
  
  .btn-primary {
    padding: 12px 24px;
    font-size: 15px;
  }
  
  .input-field {
    padding: 12px 14px;
    font-size: 15px;
  }
  
  .card {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 13px;
  }
  
  .btn-primary {
    padding: 10px 20px;
    font-size: 14px;
  }
  
  .input-field {
    padding: 10px 12px;
    font-size: 14px;
  }
  
  .card {
    padding: 16px;
  }
}

// 高对比度模式支持
@media (prefers-contrast: high) {
  .btn-primary {
    border: 2px solid $text-white;
  }
  
  .card {
    border-width: 2px;
  }
}

// 暗色模式优化（虽然抖音主要是暗色，但为了适配系统设置）
@media (prefers-color-scheme: dark) {
  .card {
    background: rgba(255, 255, 255, 0.03);
  }
  
  .input-field {
    background: rgba(255, 255, 255, 0.03);
  }
}

// 动效偏好设置
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
} 